#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define print(x) cout<<x<<'\n'
#define printe(x) cout<<x<<endl
#define prints(x) cout<<x<<" "
#define rep(i,a,b) for (int i=a;i<b;i++)
#define maxVec(v) *max_element(v.begin(),v.end())
#define minVec(v) *min_element(v.begin(),v.end())
#define bpcnt(a) __builtin_popcount(a)
#define bpcntll(a) __builtin_popcountll(a)
inline ll lsb(ll n) {return n&-n;}
inline ll msb(ll n) {return (1 << (31 - __builtin_clz(n)));}
// bool sortbysec(const pair<ll,ll> &a,
// const pair<ll,ll> &b)
// {
// return (a.second < b.second);
// }
// Fill whole array with 0.
// memset(arr, 0, n*sizeof(arr[0]));
void solve() {
int n;
cin>>n;
vector<ll> a(n,0);
rep(i,0,n) cin>>a[i];
ll maxb = a[0], ans = LLONG_MIN;
rep(i,1,n) {
if (a[i]<maxb) {
ll temp = maxb - a[i] + 1;
ll ms = 31 - __builtin_clz(temp);
if (1<<ms == temp) ans = max(ans, ms);
else ans = max(ans, ms+1);
}
maxb = max(maxb,a[i]);
}
if (ans == LLONG_MIN) print(0);
else print(ans);
return;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int it,t=1;
cin>>t;
for (it=0;it<t;it++) {
solve();
}
return 0;
}
32B - Borze | 1651B - Prove Him Wrong |
381A - Sereja and Dima | 41A - Translation |
1559A - Mocha and Math | 832A - Sasha and Sticks |
292B - Network Topology | 1339A - Filling Diamonds |
910A - The Way to Home | 617A - Elephant |
48A - Rock-paper-scissors | 294A - Shaass and Oskols |
1213A - Chips Moving | 490A - Team Olympiad |
233A - Perfect Permutation | 1360A - Minimal Square |
467A - George and Accommodation | 893C - Rumor |
227B - Effective Approach | 1534B - Histogram Ugliness |
1611B - Team Composition Programmers and Mathematicians | 110A - Nearly Lucky Number |
1220B - Multiplication Table | 1644A - Doors and Keys |
1644B - Anti-Fibonacci Permutation | 1610A - Anti Light's Cell Guessing |
349B - Color the Fence | 144A - Arrival of the General |
1106A - Lunar New Year and Cross Counting | 58A - Chat room |